<?php echo $header; ?>

<style type="text/css">
#content .blog-post a{
	border-bottom: 1px solid #DFDFDF;
    color: #21759B;
    font-weight: normal;
    text-decoration: none;
}
#content .blog-post a:hover{
	color:#D54E21;
}
#content .blog-post h2{
    font-family: Georgia,Times,"Times New Roman",serif;
    margin: 6px 0;
    font-weight: 300;
    color: #21759B;
    font-size: 22px;
    text-decoration: none;
    font-style: normal;
    line-height: 22px;
	border-bottom: 0px solid #DFDFDF;
}

#content .meta{
	color: #777777;
    font-size: 12px;
    margin-bottom: 10px;
}    
#comments p{
	color: #444444;
    font-family: sans-serif;
    font-size: 13px;
    font-style: italic;
    line-height: 22px;
    margin: 0 0 22px;
    padding: 0;
}
.storycontent p{
    margin: 0 0 22px;
    padding: 0;
    font-size: 13px;
    color: #444444;
    font-family: sans-serif;
    line-height: 22px;
}
</style>
<?php if (isset($success)) { ?>
<div class="success"><?php echo $success; ?></div>
<?php } ?>
<?php echo $column_left; ?><?php echo $column_right; ?>
<div id="content"><?php echo $content_top; ?>
  <div class="breadcrumb">
    <?php foreach ($breadcrumbs as $breadcrumb) { ?>
    <?php echo $breadcrumb['separator']; ?><a href="<?php echo $breadcrumb['href']; ?>"><?php echo $breadcrumb['text']; ?></a>
    <?php } ?>
  </div>
  <?php if ($post) { ?>
  <div class="content">
	<div class="blog-post"> 
		<h2><?php //echo $heading_title; ?><?php echo $post['title'];?></h2>
		<div class="meta">Posted <?php echo date('F j, Y',strtotime($post['created']));?> by <?=$post['author_name']?> <!--<a rel="category tag" title="View all posts in Events" href="http://wordpress.org/news/category/events/">Events</a>.--> </div>
		<div class="storycontent">
			<?php echo html_entity_decode($post['description']);?>		
		</div> 
	</div>
	<h2 class="content-title" style="margin-top:30px;clear:both;" id="content-title">Comments</h2>
	<?php if ($comment_status) { ?>
		  <div id="tab-review" class="tab-content" style="border:1px solid #DDDDDD;">
			<b><?php echo $entry_name; ?></b><br />
			<input type="text" name="name" value="" />
			<br />
			<b><?php echo $entry_email; ?></b><br />
			<input type="text" name="email" value="" />
			<br />
			<b><?php echo $entry_comment; ?></b>
			<textarea name="comment" cols="40" rows="8" style="width: 98%;"></textarea>
			<span style="font-size: 11px;"><?php echo $text_note; ?></span><br />
			<br />
			<b><?php echo $entry_captcha; ?></b><br />
			<input type="text" name="captcha" value="" />
			<br />
			<img src="index.php?route=product/product/captcha" alt="" id="captcha" /><br />
			<br />
			<div class="buttons">
			  <div class="right"><a id="button-comment" class="button"><?php echo $button_continue; ?></a></div>
			</div>
		  </div>
	<?php } ?>
	
	 <div id="comments"></div>

  </div> 
  <?php } ?>
	<?php if ( !$post) { ?>
  <div class="content"><?php echo $text_empty; ?></div>
  <div class="buttons">
    <div class="right"><a href="<?php echo $continue; ?>" class="button"><span><?php echo $button_continue; ?></span></a></div>
  </div>
  <?php } ?>
  <?php echo $content_bottom; ?></div>
<script type="text/javascript"><!--
$('#comments .pagination a').live('click', function() {
	$('#comments').slideUp('slow');
		
	$('#comments').load(this.href);
	
	$('#comments').slideDown('slow');
	
	return false;
});			

$('#comments').load('index.php?route=blog/comment&post_id=<?php echo $post_id; ?>');

$('#button-comment').bind('click', function() {
	$.ajax({
		url: 'index.php?route=blog/comment/write&post_id=<?php echo $post_id; ?>',
		type: 'post',
		dataType: 'json',
		data: 'name=' + encodeURIComponent($('input[name=\'name\']').val()) + '&email=' + encodeURIComponent($('input[name=\'email\']').val()) + '&text=' + encodeURIComponent($('textarea[name=\'comment\']').val()) + '&captcha=' + encodeURIComponent($('input[name=\'captcha\']').val()),
		beforeSend: function() {
			$('.success, .warning').remove();
			$('#button-comment').attr('disabled', true);
			$('#content-title').after('<div class="attention"><img src="catalog/view/theme/default/image/loading.gif" alt="" /> <?php echo $text_wait; ?></div>');
		},
		complete: function() {
			$('#button-comment').attr('disabled', false);
			$('.attention').remove();
		},
		success: function(data) {
			if (data.error) {
				$('#content-title').after('<div class="warning">' + data.error + '</div>');
			}
			
			if (data.success) {
				$('#content-title').after('<div class="success">' + data.success + '</div>');
				
				/* Comment Form Reseting */
				$('input[name=\'name\']').val('');
				$('input[name=\'email\']').val('');
				$('textarea[name=\'comment\']').val('');
				$('input[name=\'captcha\']').val('');
			}
		}
	});
});
//--></script> 
<?php echo $footer; ?> 